package cn.itcast.webmagic.test;

import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.processor.PageProcessor;

public class JobProcessor implements PageProcessor {
    /**
     * 解析页面
     * @param page page
     */
    public void process(Page page) {
        page.putField("ul",page.getHtml().css("div.dt mobile_txt").all());
    }
    private Site site = Site.me();
    public Site getSite() {
        return site;
    }

    public static void main(String[] args) {
        Spider.create(new JobProcessor())
                .addUrl("https://www.jd.com/")
                .run();
    }
}
